import { Code } from '~/components/text/code'
import Note from '~/components/text/note'

export const meta = {
  editUrl: 'pages/docs/api/v2/api-docs-mdx/errors/generic.mdx',
  lastEdited: '2019-10-17T14:44:04.000Z'
}

## Generic Errors

These error codes are consistent for all endpoints.

### Forbidden

You're not authorized to use the endpoint. This usually happens due to missing an user token.

<Note>Similar to the HTTP 403 Forbidden error.</Note>

<Code lang="json">{`{
  "error": {
    "code": "forbidden",
    "message": "Not authorized"
  }
}`}</Code>

### Rate Limited

You exceeded the maximum allotted requests.

The limit of request is per endpoint basis so you could continue using another endpoints even if some of them give you this error.

<Code lang="json">{`{
  "error": {
    "code": "rate_limited",
    "message": "The rate limit of 6 exceeded for 'api-www-user-update-username'. Try again in 7 days",
    "limit": {
      "remaining": 0,
      "reset": 1571432075,
      "resetMs": 1571432075563,
      "total": 6
    }
  }
}`}</Code>

### Bad Request

There was an error with the request, the `error.message` would contain information about the issue.

<Code lang="json">{`{
  "error": {
    "code": "bad_request",
    "message": "An english description of the error that just occurred",
  }
}`}</Code>

### Internal Server Error

This errors is similar to the HTTP 500 Internal Server Error error code.

<Code lang="json">{`{
  "error": {
    "code": "internal_server_error",
    "message": "An unexpected internal error occurred"
  }
}`}</Code>

### Resource Not Found

The requested resource could not be found

<Code lang="json">{`{
  "error": {
    "code": "not_found",
    "message": "Could not find the RESOURCE: ID"
  }
}`}</Code>

### Method Unknown

The endpoint you're requesting does not handle the method you defined. The error message will contain the methods the endpoint responds to.

<Code lang="json">{`{
  "error": {
    "code": "method_unknown",
    "message": "This endpoint only responds to METHOD"
  }
}`}</Code>
